﻿using System;

namespace TC
{
    public abstract class Node : ISerialize
    {
        public int id;
        public Graph graph;

        public virtual void OnCreate() { }
        
        public virtual void OnDestroy() { }
        
        public virtual void OnSerialize_t(ISerializeEntity entity)
        {
            Node_entity n = entity as Node_entity;
            n.id = id;
            n.classType = this.GetType().AssemblyQualifiedName;
        }

        public virtual void OnDeserialize_t(ISerializeEntity entity)
        {
            Node_entity n = entity as Node_entity;
            id = n.id;
        }

        public virtual ISerializeEntity CreateEntity()
        {
            return new Node_entity();
        }
    }
}
